<script setup lang="ts">
import { RouterLink,RouterView } from 'vue-router';

</script>

<template>
    <!-- 侧边栏 -->
    <div class="sidebar">
        <h2>菜单</h2>
        <RouterLink to="#">首页</RouterLink>
        <RouterLink to="#">学生管理</RouterLink>
        <RouterLink to="#">岗位管理</RouterLink>
        <RouterLink to="#">财务统计</RouterLink>
        <RouterLink to="#">设置</RouterLink>
    </div>

    <!-- 主体内容 -->
    <div class="main-content">
        <!-- Navigation Bar -->
        <div class="navbar">
            <div class="logo">勤工俭学管理系统</div>
            <div class="nav-links">
                <a href="#">设置</a>
                <a href="#">个人中心</a>
            </div>
        </div>

        <RouterView />

        <!-- Footer -->
        <div class="footer">
            © 2025 勤工俭学管理系统 版权所有
        </div>
    </div>
</template>

<style scoped>
/* 主体背景 */
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #ffffff; /* 白色背景 */
    color: #333333; /* 深灰字体颜色 */
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 60px;
    background-color: #ffffff; /* 白色背景 */
    padding: 30px 20px;
    position: fixed;
    top: 60px;
    bottom: 60px;
    left: 0;
    border-right: 1px solid #e8e8e8;
    overflow-y: auto;
    transition: width 0.3s ease;
    z-index: 1000;
}

.sidebar a {
    display: block;
    color: #333333; /* 深灰色字体 */
    text-decoration: none;
    padding: 15px;
    margin: 10px 0;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.sidebar a:hover {
    background-color: #f5f5f5; /* 浅灰色背景 */
}

.sidebar h2 {
    color: #333333;
    font-size: 24px;
    margin-bottom: 30px;
}

.sidebar:hover {
    width: 250px;
}

/* 侧边栏内容只在展开时显示 */
.sidebar-expanded a {
    visibility: visible;
}

.sidebar a {
    visibility: hidden;
}

.sidebar:hover a {
    visibility: visible;
}

/* 主体内容 */
.main-content {
    margin-left: 100px;
    width: calc(100% - 100px);
    padding: 30px;
    flex-grow: 1;
    overflow: auto;
    padding-bottom: 60px;
    transition: margin-left 0.3s ease, width 0.3s ease;
    background-color: #ffffff;
}

/* 当侧边栏展开时的主体内容样式 */
.sidebar:hover + .main-content {
    margin-left: 290px;
    width: calc(100% - 290px);
}

/* Navigation Bar */
.navbar {
    background-color: #ffffff;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #333333;
    font-size: 18px;
    border-bottom: 1px solid #e8e8e8;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-sizing: border-box;
}

.navbar a {
    color: #333333;
    text-decoration: none;
    margin: 0 15px;
    font-weight: bold;
}

.navbar a:hover {
    color: #4A90E2;
}

.nav-links {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
}

/* Footer */
.footer {
    background-color: #ffffff;
    padding: 15px;
    text-align: center;
    font-size: 14px;
    border-top: 1px solid #e8e8e8;
    color: #333333;
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    box-sizing: border-box;
    z-index: 999;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr 1fr;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    .navbar, .footer {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        grid-template-columns: 1fr;
    }
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
    }
}
</style>    
